#define _CRT_SECURE_NO_WARNINGS	

#include<cstdio>
#include<queue>
using namespace std;

typedef int ELEMTYPE;

typedef struct Two_QueuetoStack
{
	queue<ELEMTYPE>q1;
	queue<ELEMTYPE>q2;
}Two_QueuetoStack;

void Push_TQS(Two_QueuetoStack* pqs, ELEMTYPE val)
{
	pqs->q1.push(val);
}

void Pop_TQS(Two_QueuetoStack* pqs)
{
	if (!pqs->q1.empty() || !pqs->q2.empty())
	{
		if (!pqs->q1.empty())
		{
			while (pqs->q1.size() > 1)
			{
				pqs->q2.push(pqs->q1.front());
				pqs->q1.pop();
			}
			pqs->q1.pop();
		}
		else
		{
			while (pqs->q2.size() > 1)
			{
				pqs->q1.push(pqs->q2.front());
				pqs->q2.pop();
			}
			pqs->q2.pop();
		}
	}

}
